Page({
  data: {
    banners: [
      '/images/carousel1.jpg',
      '/images/carousel2.jpg',
      '/images/carousel3.jpg'
    ],
    categories: [
      { id: 1, name: '蛋糕', image: '/images/cake1.jpg' },
      { id: 2, name: '饼干', image: '/images/cake2.jpg' }
    ],
    products: [
      { id: 1, name: '草莓蛋糕', image: '/images/cake1.jpg', price: 30 },
      { id: 2, name: '巧克力蛋糕', image: '/images/cake2.jpg', price: 40 }
    ]
  },
  goToCategory(e) {
    const id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/category/category?id=${id}`
    });
  },
  goToProduct(e) {
    const id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/product/product?id=${id}`
    });
  },
  goToOrders() {
    wx.navigateTo({
      url: `/pages/orders/orders`
    });
  },
  goToPickup() {
    wx.navigateTo({
      url: `/pages/pickup/pickup`
    });
  },
  goToDelivery() {
    wx.navigateTo({
      url: `/pages/delivery/delivery`
    });
  },
  goToCoupon() {
    wx.navigateTo({
      url: `/pages/coupon/coupon`
    });
  },
  goToPoints() {
    wx.navigateTo({
      url: `/pages/points/points`
    });
  },
  goToGift() {
    wx.navigateTo({
      url: `/pages/gift/gift`
    });
  },
  goToOrder() {
    wx.switchTab({
      url: '/pages/order/order'
    });
  },
  goToUser() {
    wx.switchTab({
      url: '/pages/user/user'
    });
  },
  goToHome() {
    wx.switchTab({
      url: '/pages/index/index'
    });
  }
});
